package com.bee.tlweb.view;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.beetl.ext.servlet.ServletGroupTemplate;

import com.bee.tlweb.model.News;
import com.bee.tlweb.service.PortalService;

/**
 * Servlet implementation class NewsServlet
 */
public class NewsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public NewsServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");	
		PortalService portalService = new PortalService();
		List<News> list = portalService.getNews(News.GNENERAL_NEWS);
	
		request.setAttribute("newsList", list);
		request.setAttribute("sessionId", "121212121212");
		
		ServletGroupTemplate.instance().render("/news.html", request, response);

		
	}

}
